<template>
	<view class="container" :style="{minHeight:$height()}">
		<view class="box">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="order-no king-align__center king-flex__between">
					<view class="left king-align__center">
						<view class="line"></view>
						<text>类型：{{item.name}}</text>
					</view>
				</view>
				<u-line margin="20rpx 0px"></u-line>
				<view class="info">
					<view class="king-flex king-flex__column">

						<view class="king-align__center info-item">
							<text>警灯位置：</text>
							<text>{{item.warningLocation}}</text>
						</view>
						<view class="king-align__center info-item">
							<text>状态：</text>
							<u-tag size="error" v-if="item.taskStatus == 0" text="停用"></u-tag>
							<u-tag type="success" size="mini" v-else text="正常"></u-tag>
						</view>
						<view class="king-align__center info-item">
							<text>备注：</text>
							<text>{{item.remark}}</text>
						</view>

					</view>
				</view>
				<u-line margin="20rpx 0px"></u-line>
				<view class="footer king-align__center king-flex__between">
					<view class="createTime u-line-1">
						{{item.createTime}}
					</view>
					<!-- <u-radio :name="item.id"></u-radio> -->
				</view>
			</view>


			<u-loadmore v-if="list.length !== 0" :status="more" :load-text="loadText" />
			<u-empty v-else :icon="$utils.imagePath('/assets/img/data.png')" mode="data" marginTop="30%"></u-empty>
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				loadText: {
					loadmore: '轻轻上拉，加载更多',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				page: 1,
				list: [],
			}
		},
		created() {
			this.getExecptTypeRes()
		},
		onLoad() {

		},
		methods: {
			//下拉刷新
			onPullDownRefresh() {
				this.page = 1
				this.getExecptTypeRes()
			},
			//上拉加载
			onReachBottom() {
				if (this.page == 1) {
					return
				}
				if (this.more == 'loadmore') {
					this.getExecptTypeRes()
				}
			},
			getExecptTypeRes() {
				this.more = 'loading'
				let params = Object.assign({
					current: this.page,
					size: 20,
					sortField: "id",
					sortOrder: "descend"
				}, this.formData)
				this.$axios.request(this.$api.getExecptTypeRes, "GET", params).then((val) => {
					uni.stopPullDownRefresh();
					this.list = this.page == 1 ? val.data.records : this.list.concat(val.data.records)
					if (this.page / 1 < val.data.total / 20) {
						this.more = 'loadmore';
						this.page++
					} else {
						this.more = 'nomore';
					}

				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 96%;
		margin: 10px auto;

		.item {
			background-color: #ffffff;
			margin: 20rpx auto;
			width: 100%;
			box-shadow: 0px 2px 6px 2px #eaeaea;
			border-radius: 10rpx;
			border-radius: 10rpx;
			box-sizing: border-box;
			padding: 20rpx;
			font-size: 14px;

			.left {
				.line {
					width: 9rpx;
					height: 30rpx;
					background-color: #0081ff;
				}

				text {
					margin: 0 5px;
					font-size: 18px;
					font-weight: bold;
				}
			}

			.right {
				text {
					color: #0081ff;
					font-size: 28rpx;
				}

				.progress {
					width: 156rpx;
				}
			}

			.info {
				font-size: 14px;
			}

			.info-item {
				margin-bottom: 5px;
				justify-content: space-between;
			}

			.info-item:last-child {
				margin-bottom: 0px;
			}

			.footer {
				.createTime {
					font-size: 28rpx;
					width: 80%;
				}

			}
		}
	}
</style>